package com.kyh.sys.entity;


import java.util.Date;

import javax.persistence.Table;

import com.alibaba.fastjson.JSONObject;
import com.kyh.annotation.Model;
import com.kyh.entity.base.BaseEntity;

/**
*/
@Table(name="sys_module", catalog="module_id")
public class Module extends BaseEntity<Module> {

	@Model(nameTable="moduleId")
	private Long moduleId; // 主键ID
	@Model(nameTable="moduleName")
	private String moduleName; // 模块名称
	@Model(nameTable="status")
	private Integer status; // 0禁用1可用
	@Model(nameTable="createTime",type=Model.TYPE.DATE, format="yyyy-MM-dd HH:mm:ss")
	private Date createTime; // 
	@Model(nameTable="updateTime",type=Model.TYPE.DATE, format="yyyy-MM-dd HH:mm:ss")
	private Date updateTime; // 

	public Long getModuleId() {
		return moduleId;
	}
	public Module setModuleId(Long moduleId) {
		this.moduleId = moduleId;
		return this;
	}
	public String getModuleName() {
		return moduleName;
	}
	public Module setModuleName(String moduleName) {
		this.moduleName = moduleName;
		return this;
	}
	public Integer getStatus() {
		return status;
	}
	public Module setStatus(Integer status) {
		this.status = status;
		return this;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public Module setCreateTime(Date createTime) {
		this.createTime = createTime;
		return this;
	}
	public Date getUpdateTime() {
		return updateTime;
	}
	public Module setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
		return this;
	}

	public static Module module(
			String moduleName,
			Integer status
			) {
		Module entity = new Module();
		entity.setModuleName(moduleName);
		entity.setStatus(status);
		return entity;
	}
	
	public JSONObject tree() {
		JSONObject JO = new JSONObject();
		JO.put("id", this.moduleId);
		JO.put("pid", -1L);
		JO.put("text", this.moduleName);
		JO.put("type", "module");
		return JO;
	}
}